Imports System
Imports System.Collections.Generic
Imports System.Globalization
Imports System.Text
Imports System.Web
Imports System.Xml
Imports System.Xml.Serialization
Imports Aricie.DNN.Modules.LuceneSearch.Business
Imports Aricie.DNN.Services

Namespace Aricie.DNN.Modules.LuceneSearch.SiteMap
    Public Class SiteMap
        Implements IHttpHandler
        Implements IRequiresSessionState



        Public Sub ProcessRequest(ByVal context As HttpContext) Implements System.Web.IHttpHandler.ProcessRequest
           
            context.Response.ContentType = "text/xml"
            Dim urlCollection As UrlCollection = BusinessController.GetSitemap(NukeHelper.PortalId)

            Dim serializer As XmlSerializer = Aricie.Services.ReflectionHelper.GetSerializer(Of UrlCollection)()
            Dim xmlTextWriter As New XmlTextWriter(context.Response.OutputStream, Encoding.UTF8)
            serializer.Serialize(DirectCast(xmlTextWriter, XmlWriter), urlCollection)
        End Sub


        ' Properties
        Public ReadOnly Property IsReusable() As Boolean Implements System.Web.IHttpHandler.IsReusable
            Get
                Return False
            End Get
        End Property

    End Class
End Namespace
